dojo.provide("mydojo.FilteringSelect");
dojo.require("dojox.grid._data.editors");
dojo.require("dijit.Editor");
dojo.require("dijit.form.FilteringSelect");
//[dojox.grid.editors.AlwaysOn,dojox.grid.editors.Dijit]don,t work
dojo.declare("mydojo.FilteringSelect", dojox.grid.editors.Dijit, {
    editorClass: "dijit.form.FilteringSelect",
    getEditorProps: function(inDatum){
        var items=[];
        var o=this.cell.options;
        var v;
        if(this.cell.values){
            v=this.cell.values;
        }else{
            o=this.cell.options;
        }
        /*dojo.forEach(this.cell.options, function(o){
            items.push({name: o, value: o});
        });*/
        
        for(var i=0; i<o.length;i++){
            items.push({name: o[i], value: v[i]});
        }
        var store = new dojo.data.ItemFileReadStore({data: {identifier:"value", items: items}});
        return dojo.mixin({}, this.cell.editorProps||{}, {
            value: inDatum,
            store: store
        });
    },
   
    getValue: function(){
        var e = this.editor;
        // make sure to apply the displayed value
        //alert("e.getDisplayedValue()"+e.getDisplayedValue());
         //alert("e.getValue()"+e.getValue());
        e.setDisplayedValue(e.getDisplayedValue());
        if(e.getValue()==''){
         return e.getDisplayedValue();
        }else{
         return e.getValue()+'*'+e.getDisplayedValue();
        }
    }
});
